﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="DigDes.DSchool.SUPS.Web.UI.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title> RailwayTracking2013</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h1>DataGrid</h1>
       <asp:GridView ID="GridView1" runat="server" AllowPaging="True" Width="640px"
           AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource" 
           >
            <Columns>
                <asp:BoundField DataField="InventoryCarriageNumber" HeaderText="Инв. номер вагона"/>
                <asp:BoundField DataField="WeightTons" HeaderText="Вес груза в тоннах"  />
                <asp:BoundField DataField="CargoName" HeaderText="Станция назначения вагона" />
                <asp:BoundField DataField="ConsigneeCode" HeaderText="Код грузополучателя"/>
                <asp:BoundField DataField="ParkType" HeaderText="Тип парка вагона" />
                <asp:BoundField DataField="StartStation" HeaderText="Станция начала рейса"  />
                <asp:BoundField DataField="CarOperation" HeaderText="Операция"/>
                <asp:BoundField DataField="Date" HeaderText="Дата"/>
                <asp:BoundField DataField="Time" HeaderText="Время"/>
                <asp:BoundField DataField="OpStation" HeaderText="Станция сверш. операции" />
                <asp:BoundField DataField="DelRoad" HeaderText="Дорога сдачи	" />
                <asp:BoundField DataField="RecRoad" HeaderText="Дорога приема"  />
                <asp:BoundField DataField="TrainIndex" HeaderText="Индекс поезда"/>
                <asp:BoundField DataField="TrainNumber" HeaderText="Номер поезда"  />
            </Columns>

       
        </asp:GridView>
      <asp:SqlDataSource ID="SqlDataSource" runat="server" ConnectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=&quot;C:\Users\Sasha\Documents\Visual Studio 2012\Projects\railwaytracking2013\Personal\Alexandr Vagner\DigDes.DSchool.SUPS\DigDes.DSchool.SUPS.Test.App\bin\Debug\SUPS.mdf&quot;;Integrated Security=True;Connect Timeout=30" ProviderName="System.Data.SqlClient" 
          SelectCommand="select InventoryCarriageNumber,WeightTons,Cargo.Name as CargoName,ConsigneeCode,ParkType,StartStation.Name as StartStation,CarOperation.Name as CarOperation,SUBSTRING(OperationDate,1,2)+'.'+SUBSTRING(OperationDate,3,2)+'.'+OperationYear as Date,SUBSTRING(OperationTime,1,2)+':'+SUBSTRING(OperationTime,3,2) as Time,OpStation.Name as OpStation,DelRoad.Name as DelRoad,RecRoad.Name as RecRoad,Dis.TrainIndex as TrainIndex,Dis.TrainNumber as TrainNumber
                        from tbDislocation as Dis,Cargo,Station as StartStation,CarOperation,Station as OpStation,Road as DelRoad,Road as RecRoad
                        where Cargo.ShortCode=Dis.CargoCodeTariff_ShortCode and
	                    StartStation.Code=Dis.StartStation_Code and
	                    CarOperation.Code=Dis.OperationCode_Code and CarOperation.OperationType=Dis.OperationType_Code and
	                    OpStation.Code=Dis.StationOfOperation_Code and
	                    Dis.DeliveryRoad_Code=DelRoad.Code and
	                    Dis.ReceiptRoad_Code=RecRoad.Code;"></asp:SqlDataSource>
    </form>
</body>
</html>
